//
//  BNDFileInfo.m
//  OfficeDoc
//
//  Created by pie on 2022/4/19.
//  Copyright © 2022 pie. All rights reserved.
//

#import "BNDFileInfo.h"

@implementation BNDFileInfo

+ (NSDictionary *)modelCustomPropertyMapper
{
    return @{@"modelID" : @"id"
    };
}

- (void)setFileJson:(NSString *)fileJson
{
    _fileJson = fileJson;
    _fileJsonArray = [BNDFileInfo toArrayOrNSDictionary:fileJson];
}

+ (id)toArrayOrNSDictionary:(NSString *)jsonData
{
    if (jsonData != nil) {
        NSData* data = [jsonData dataUsingEncoding:NSUTF8StringEncoding];
        id jsonObject = [NSJSONSerialization JSONObjectWithData:data
                                                        options:NSJSONReadingAllowFragments
                                                          error:nil];
        
        if (jsonObject != nil){
            return jsonObject;
        }else{
            // 解析错误
            return nil;
        }
    }
    return nil;
}


@end
